import Vue from 'vue';
import VueRouter from 'vue-router';
import HomeView from '../view/home';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
    },
    // javascript示例
    {
        path: '/JavaScriptDemo',
        name: 'JavaScriptDemo',
        component: () => import(/* webpackChunkName: "about" */ '../view/JavaScriptDemo'),
    },
    // 样式布局
    {
        path: '/StyleDemo',
        name: 'StyleDemo',
        component: () => import(/* webpackChunkName: "about" */ '../view/StyleDemo'),
    },
    // flex实现上中下自适应布局
    {
        path: '/FlexFullScreen',
        name: 'FlexFullScreen',
        component: () => import(/* webpackChunkName: "about" */ '../view/FlexFullScreen'),
    },
];

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
});

export default router;
